<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:form="http://java.sun.com/jsf/composite/components/form"
	template="/templates/include/securedmain.xhtml">

	<ui:define name="content" >
	<h:outputText value="#{msg['view.usereditchangepass.form.notpossible']}" rendered="#{!editMyProfileBean.passwordStoredLocally}"/>
		<h:form id="form" 
				rendered="#{editMyProfileBean.passwordStoredLocally}">
			<h:inputHidden value="true">
				<f:validator validatorId="changemypassvalidator" />
				<f:attribute name="oldpwd" value="#{oldpwd}" />
				<f:attribute name="usrid"
					value="#{editMyProfileBean.selectedUser.id}" />
			</h:inputHidden>


			<p:growl id="growl" sticky="false" />


			<h:panelGrid columns="2">
				<f:facet name="header">
					<h:outputText value="#{msg['view.usereditchangepass.form.head']}:" />
				</f:facet>

				<h:outputLabel for="nickname"
					value="#{msg['properties.user.nickname']}:" />
				<h:outputText value="#{editMyProfileBean.selectedUser.nickname}"
					id="nickname" required="true" />

				<h:outputLabel for="oldpwd"
					value="#{msg['properties.user.oldpassword']}:" />
				<p:password id="oldpwd" binding="#{oldpwd}"
					value="#{editMyProfileBean.oldpasshash}" required="true"
					converter="md5converver" />

				<h:outputLabel for="pwd1"
					value="#{msg['properties.user.password']}:" />
				<p:password minLength="5" id="pwd1"
					value="#{editMyProfileBean.selectedUser.passhash}" match="pwd2"
					required="true" feedback="true" converter="md5converver" />

				<h:outputLabel for="pwd2"
					value="#{msg['properties.user.passwordagain']}:" />
				<p:password minLength="5" id="pwd2"
					value="#{editMyProfileBean.selectedUser.passhash}" required="true"
					converter="md5converver" />

				<f:facet name="footer">
					<p:commandButton id="commitButton"
						action="#{editMyProfileBean.edit}"
						value="#{msg['view.actions.button.commit']}" update="@form"
						ajax="false" />
				</f:facet>
			</h:panelGrid>
		</h:form>
	</ui:define>
</ui:composition>
